<?php
namespace Admin\Controller;
use Think\Controller;
class WithdrawController extends CommonController {
	
	public function _initialize(){
	parent::_initialize();
	$this->model="withdraw".YEAR;
	$this->key="wd_id";	
	$this->title_index= L('index');
	$this->title_details=L('details');
	}	

	public function index(){
		$mist_arr=array();
		$accute_arr=array('wd_status'=>I("wd_status"),'wd_mid'=>I('wd_mid'));
		$cookie_arr=array();		
		$con=searchCon($mist_arr,$accute_arr,$cookie_arr);
		parent::index($con);
	}
	
	public function updateHandle(){
		if(I("wd_status")==1)
			$this->error(L("operation_forbiden"));
		
		//调用对账单方法
		if(I("wd_status")==3){
		$result=createStatement(I("wd_mid"),7,I("wd_amount"),"Withdraw voided");
		if(!$result)
			$this->error(L("action_failed"));
		}
			parent::updateHandle();
		
	}
	
}